﻿using System.Net;

namespace PacketRush.Core
{
    /// <summary>
    /// Represents a connection between two end points
    /// </summary>
    public interface INetConnection
    {
        /// <summary>
        /// The unique id of this connection.
        /// </summary>
        int Id { get; set; }

        /// <summary>
        /// The remote end point of which this connection is connected to.
        /// </summary>
        EndPoint RemoteEndPoint { get; }

        /// <summary>
        /// The local end point.
        /// </summary>
        EndPoint LocalEndPoint { get; }

        /// <summary>
        /// True if this connection is currently connected.
        /// </summary>
        bool Connected { get; }

        /// <summary>
        /// The round-trip latency of this user in milliseconds.
        /// </summary>
        int Latency { get; set; }

        /// <summary>
        /// Returns a sequence index for a packet destined for this connection,
        /// implementations should ensure that an incrementing number is returned
        /// starting from 1.
        /// </summary>
        /// <returns>An incrementing number starting from 1.</returns>
        uint CreateNextPacketSequenceIndex();
    }
}
